import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/mobile/checkBox",
    },
    {
      path: "/mobile",
      name: "mobile",
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import("../views/Home/index.vue"),
      children: [
        {
          path: "form",
          name: "form",
          component: () => import("../views/Mobile/index.vue"),
        },
        {
          // 复选框
          path: "checkBox",
          name: "checkBox",
          component: () => import("@/views/Mobile/checkBox.vue"),
        },
        {
          // 同意协议
          path: "agreement",
          name: "agreement",
          component: () => import("@/views/Mobile/agreement.vue"),
        },
        {
          // 事时间范围
          path: "dateRange",
          name: "dateRange",
          component: () => import("@/views/Mobile/dateRange.vue"),
        },
        {
          // 详情
          path: "datePicker",
          name: "datePicker",
          component: () => import("@/views/Mobile/datePicker.vue"),
        },
        {
          path: "detailPage",
          name: "detailPage",
          component: () => import("@/views/Mobile/detailPage.vue"),
        },
        {
          // 多选组
          path: "selectorList",
          name: "selectorList",
          component: () => import("@/views/Mobile/selectorList.vue"),
        },
        {
          // 文件上传
          path: "imageUpload",
          name: "imageUpload",
          component: () => import("@/views/Mobile/imageUpload.vue"),
        },
        {
          // 下拉框
          path: "select",
          name: "select",
          component: () => import("@/views/Mobile/select.vue"),
        },
        {
          // 弹窗
          path: "modal",
          name: "modal",
          component: () => import("@/views/Mobile/modal.vue"),
        },
        {
          // 地址
          path: "mapAddress",
          name: "mapAddress",
          component: () => import("@/views/Mobile/mapAddress.vue"),
        },
        {
          // 时间范围
          path: "dataRange",
          name: "dataRange",
          component: () => import("@/views/Mobile/dataRange.vue"),
        },
        {
          // 文本域
          path: "textFiles",
          name: "textFiles",
          component: () => import("@/views/Mobile/textFiles.vue"),
        },
        {
          // 图片预览
          path: "imagesPreview",
          name: "imagesPreview",
          component: () => import("@/views/Mobile/imagesPreview.vue"),
        },
      ],
    },
  ],
});

export default router;
